package com.arithmeticEveryDay.leetCode;

import java.util.Scanner;
/*

110010
110
1
4


110010 --> 100000   +
   << i             >--> 101100
110 --> 001100


50
6
1
4


 */
public class SolutionInterview0501 {
    
    public int insertBits(int N, int M, int i, int j) {
        // 将i~j位置零
        for (int k = i; k <= j; k++) {
            N &= ~(1 << k);
        }
        return N | (M << i);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int i = scan.nextInt();
        int j = scan.nextInt();
        SolutionInterview0501 s = new SolutionInterview0501();
        System.out.println(Integer.toBinaryString(s.insertBits(n, m, i, j)));

    }

}
